package com.blog.dao;

import com.blog.dto.FavoriteDTO;
import com.blog.pojo.Articles;
import com.blog.pojo.Favorite;
import com.blog.pojo.Start;

import java.util.List;

public interface ArticlesDao {
    //添加文章
    public int addArticles(Articles articles);
    //删除文章
    public int deleteArticles(int id);
    //修改文章
    public int updateArticles(Articles articles);
    //查询文章--作者
    public  List<Articles>  findByAuthor(String  author);
    //查询文章--title
    public  Articles findByTitle(String title);
    //查询文章--全部
    public List<Articles> findAll();
    //查询文章--id
    public Articles findById(int id);
    //查询文章--用户id
    public List<Articles> finbByUserId(int userId);
    //查询未发布的文章--用户id+status=0
    public List<Articles> findByUserIdAndStatus(int userId, byte status);



    //删除点赞
    public int deleteStart(int articleId,int userId);
    //添加点赞
    public int addStart(Start start);
    //查询点赞总数
    public long findStartCount(int articleId,Byte start);
    //查询--文章+点赞+用户
    public boolean findStart(int articleId, int userId, Byte start);
    //添加收藏
    public int addFavorite(Favorite  favorite);
    //删除收藏
    public int deleteFavorite(int articleId,int userId);
    //查询收藏总数
    public long findFavoriteCount(int articleId);
    //查询--文章+收藏+用户
    public boolean findFavorite(int userId , int articleId, Byte favorite);
    //点赞总数
    public int updateStartCount(int articleId, long StartCount);
    //收藏总数
    public int updateFavoriteCount(int articleId, long favoriteCount);
    //判断是否点赞
    public boolean userLiked(int articleId, int userId);
    //判断是否收藏
    public boolean userFavorited(int articleId, int userId);

    //收藏列表--用户id
    public List<Favorite> findFavoriteList(int userId);

    public List<Start> userLikedArticles(int userId, List<Integer> articleIds);
}
